package com.lingnan.wanxiangxinxun.mapper;

import com.lingnan.wanxiangxinxun.entity.bo.News_returnNameBO;
import com.lingnan.wanxiangxinxun.entity.dto.News_client_updateDTO;
import com.lingnan.wanxiangxinxun.entity.dto.query.News_query_pushByUserLikeDTO;
import com.lingnan.wanxiangxinxun.entity.po.News;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 新闻表 Mapper 接口
 * </p>
 *
 * @author swl
 * @since 2025-03-13
 */
public interface NewsMapper extends BaseMapper<News> {

//    @Select("select nc.id as categoryId, count(nc.id) as num " +
//            "from user_like ul " +
//            "right join news n on ul.news_id = n.id " +
//            "right join news_category nc on n.category_id = nc.id " +
//            "where ul.user_id = #{userId} " +
//            "group by nc.id " +
//            "order by num desc " +
//            "limit 0,20")
//    List<News_query_pushByUserLikeDTO> getNewsIdByUserLike(Integer userId);


    List<News_query_pushByUserLikeDTO> getNewsIdByUserLike(Collection<String> newsIdList);


    //根据传入的新闻id，查询出对应新闻的作者名，审核员名，新闻类型名
    List<News_returnNameBO> getNames(List<Integer> newsIds);

    //修改某条新闻的浏览、点赞、收藏数量
    void updateNewData(News_client_updateDTO newsDTO);
}
